<template>
  <div class="apply">
    <div style="padding-left: 27px">
      共计{{ count }}个,其中已通过{{ yitongguo }}个，未通过{{
        weitongguo
      }}个,已提交{{ weishenhe }}个,未提交{{ weitijao }}个
    </div>
    <div class="caozuo">
      <div class="gongneng">
        <div></div>
        <div>
          <el-select
            v-model="is_allow"
            placeholder="请选择审核状态"
            @change="is_allows"
          >
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </div>
        <div>
          <el-input
            placeholder="请输入内容"
            v-model="com_name"
            class="input-with-select"
            @input="com_names"
          >
            <el-button slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </div>
      </div>
      <div>
        <el-button
          type="primary"
          size="mini"
          icon="el-icon-edit"
          :disabled="disabled"
          @click="shenhe"
          >通过审核</el-button
        >
        <el-button
          type="primary"
          size="mini"
          icon="el-icon-edit"
          :disabled="disabled"
          @click="handleput1()"
          >驳回</el-button
        >
        <el-button
          type="primary"
          size="mini"
          icon="el-icon-edit"
          :disabled="disabled"
          @click="del"
          >删除</el-button
        >
        <el-button
          type="primary"
          size="mini"
          icon="el-icon-edit"
          @click="daochu"
          >导出数据</el-button
        >
      </div>
    </div>
    <div class="table">
      <el-table
        ref="multipleTable"
        :data="tableData"
        tooltip-effect="dark"
        @selection-change="handleSelectionChange"
        size="small"
        stripe
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
        :highlight-current-row="aaa"
      >
        <el-table-column type="index" label="序号">
          <template scope="scope">
            <span>{{ (page - 1) * 15 + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column type="selection"></el-table-column>
        <el-table-column
          prop="com_name"
          label="单位名称"
          style="font-size: 18px"
        ></el-table-column>
        <el-table-column prop="com_type" label="单位类型"></el-table-column>
        <el-table-column prop label="申报内容" style="heigth: 50px">
          <template slot-scope="scope">
            <!-- <div style=" height: 60px;overflow-y: scroll;"> -->
            <div>
              <div v-for="(item, index) in scope.row.award" :key="index">
                {{ item.award_name }},数量：{{ item.num }}
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="num" label="申报数量"></el-table-column>
        <el-table-column prop="is_allow" label="审核状态" @click="tupian">
          <template slot-scope="scope">
            <div v-if="scope.row.is_allow == 1">通过</div>
            <div v-if="scope.row.is_allow == 2">不通过</div>
            <div v-if="scope.row.is_allow == 3">已提交</div>
            <div v-if="scope.row.is_allow == 0">未提交</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="no_allow_resule"
          label="驳回原因"
          width="200"
          @click="tupian"
        ></el-table-column>
        <el-table-column label="操作" width="300">
          <template slot-scope="scope">
            <div>
              <!-- <el-button
                type="primary"
                size="mini"
                icon="el-icon-share"
                class="btn"
                @click="shuliang(scope.row)"
                v-if="group_id == -1"
                >修改数量</el-button
              > -->
              <el-button
                type="primary"
                size="mini"
                icon="el-icon-share"
                class="btn"
                @click="tupian(scope.row)"
                >浏览</el-button
              >
              <el-button
                type="primary"
                size="mini"
                icon="el-icon-share"
                class="btn"
                @click="handledetails(scope.row)"
                >通过审核</el-button
              >
              <el-button
                class="btn"
                type="primary"
                size="mini"
                icon="el-icon-edit"
                @click="handleput(scope.row)"
                >驳回</el-button
              >
              <el-button
                class="btn"
                type="primary"
                size="mini"
                icon="el-icon-edit"
                v-if="username == '韩羽' || username == '刘辰'|| username == '郝雨'"
                @click="addZiZhangHao(scope.row)"
                >新增子账号</el-button
              >
            </div>
            <div>
              <el-button
                class="btn"
                type="primary"
                size="mini"
                icon="el-icon-edit"
                @click="handleput2(scope.row)"
                v-if="group_id == -1"
                >修 改</el-button
              >
              <el-button
                class="btn"
                type="primary"
                size="mini"
                icon="el-icon-edit"
                @click="handleput2(scope.row)"
                v-else-if="is_gai == 1"
                >修 改</el-button
              >
              <el-button
                class="btn"
                type="primary"
                size="mini"
                icon="el-icon-delete"
                @click="handleDel(scope.row)"
                >删 除</el-button
              >
              <el-button
                class="btn"
                type="primary"
                size="mini"
                icon="el-icon-s-comment"
                @click="xiangqing(scope.row)"
                style="color: #f0381e"
                >更多信息</el-button
              >
            </div>
          </template>
        </el-table-column>
        <!-- <el-table-column prop="user_name" label="联系人姓名" width="130" style="font-size: 18px;"></el-table-column> -->
        <!-- <el-table-column prop="branch" label="部门" width="150" style="font-size: 18px;"></el-table-column> -->
        <!-- <el-table-column prop="mobile" label="手机号" width="150" style="font-size: 18px;"></el-table-column> -->
        <!-- <el-table-column prop="email" label="邮箱" width="150" style="font-size: 18px;height:40px"></el-table-column> -->
        <!-- <el-table-column prop="create_time" label="注册时间" width="170"></el-table-column> -->
        <!-- <el-table-column prop="reason" label="修改原因" width="170"> -->
        <!-- <template slot-scope="scope">
            <div v-for="(item,index) in scope.row.reason" :key="index">{{item.reason}}</div>
          </template>
        </el-table-column>-->
      </el-table>
    </div>
    <!-- <el-dialog title="修改密码" :visible.sync="dialogFormVisible" width="30%">
      <el-form :model="form">
        <el-form-item label="旧密码" :label-width="formLabelWidth">
          <el-input v-model="form.mima" autocomplete="off" placeholder="请输入旧密码"></el-input>
        </el-form-item>
        <el-form-item prop="phones" label="新密码" :label-width="formLabelWidth">
          <el-input
            oninput="value=value.replace(/[\W]/g,'')"
            maxlength="20"
            type="password"
            v-model="form.password"
            placeholder="请输入密码"
          />
        </el-form-item>
        <el-form-item prop="phones" label="新密码" :label-width="formLabelWidth">
          <el-input
            oninput="value=value.replace(/[\W]/g,'')"
            maxlength="20"
            type="password"
            v-model="form.password1"
            placeholder="请再次输入密码"
            @blur="Verification"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>-->
    <div class="fenye">
      <el-pagination
        background
        layout="prev, pager, next"
        :total="totalPage"
        :page-size="pageSize"
        @current-change="handleSizeChange"
      ></el-pagination>
    </div>
    <el-dialog :visible.sync="centerDialogVisible" width="30%" center>
      <div class="tongguo">是否通过</div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="quedingtongguo">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="chageVisible" width="30%" center>
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item label="驳回意见" prop="desc">
          <el-input type="textarea" v-model="ruleForm.desc"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            @click="
              arr.length != 0 ? submitForm1('ruleForm') : submitForm('ruleForm')
            "
            >提交</el-button
          >
          <el-button @click="resetForm('ruleForm')">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-dialog title="信息" :visible.sync="dialogVisible" width="40%">
      <div class="image">
        <img :src="src" alt />
      </div>
    </el-dialog>
    <el-dialog title="修改" :visible.sync="dialogXiugai" width="30%">
      <el-form
        :model="ruleForm"
        status-icon
        :rules="rules"
        ref="ruleForm"
        label-width="140px"
        class="demo-ruleForm"
      >
        <div v-for="(item, index) in award" :key="index">
          <el-form-item :label="item.award_name" prop="pass">
            <el-input
              type="Number"
              v-model="award[index].num"
              autocomplete="off"
            ></el-input>
          </el-form-item>
        </div>
        <el-form-item label="修改原因" prop="pass">
          <el-input type="text" v-model="reason" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogXiugai = false">取 消</el-button>
        <el-button type="primary" @click="queding">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="详情" :visible.sync="xiangqingVisible" width="30%" center>
      <div class="items">
        <div>联系人姓名</div>
        <div>{{ xiangqing1.user_name }}</div>
      </div>
      <div class="items">
        <div>部门</div>
        <div>{{ xiangqing1.branch }}</div>
      </div>
      <div class="items">
        <div>手机号</div>
        <div>{{ xiangqing1.mobile }}</div>
      </div>
      <div class="items">
        <div>邮箱</div>
        <div>{{ xiangqing1.email }}</div>
      </div>
      <div class="items">
        <div>注册时间</div>
        <div>{{ xiangqing1.create_time }}</div>
      </div>
      <div class="items">
        <div>修改原因</div>
        <div>
          <div v-for="(item, index) in xiangqing1.reason" :key="index">
            {{ item.reason }}
          </div>
        </div>
      </div>
      <!-- <div class="items">
        <div>联系人姓名</div>
        <div>{{xiangqing1.user_name}}</div>
      </div>-->
      <span slot="footer" class="dialog-footer">
        <el-button @click="xiangqingVisible = false">取 消</el-button>
        <el-button type="primary" @click="xiangqingVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog title="修改数量" :visible.sync="dialogVisibleS" width="400px">
      <el-input
        v-model="nums"
        type="Number"
        placeholder="请输入内容"
      ></el-input>
      <div class="assa">
        <div></div>
        <el-button type="primary" @click="addNums">确定</el-button>
      </div>
    </el-dialog>

    <!-- ----------- -->
    <el-dialog
      title="增加子账号"
      :visible.sync="centerDialogVisiblese"
      width="30%"
      center
    >
      <el-form
        :model="ruleForms"
        :rules="rulese"
        ref="ruleForms"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item label="用户名" prop="com_name">
          <el-input v-model="ruleForms.com_name"></el-input>
          <div class="tishi">
            *个人奖为申报人中文名字，创新成果奖为第一完成人中文名字，单位奖为联系人中文名字
          </div>
        </el-form-item>
        <el-form-item label="密码" prop="password">
          <el-input v-model="ruleForms.password"></el-input>
        </el-form-item>
        <el-form-item label="奖项" prop="password">
          <el-select v-model="ruleForms.award_id" placeholder="请选择奖项">
            <el-option
              v-for="item in options1"
              :key="item.id"
              :label="item.award_name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="申报类型" prop="password">
          <el-select v-model="ruleForm.type_id" placeholder="请选择申报类型">
            <el-option
              v-for="item in options"
              :key="item.id"
              :label="item.com_type"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item> -->
        <el-form-item label="部门" prop="branch">
          <el-input v-model="ruleForms.branch"></el-input>
        </el-form-item>
        <el-form-item label="姓名" prop="user_name">
          <el-input v-model="ruleForms.user_name"></el-input>
        </el-form-item>
        <el-form-item label="电话" prop="mobile">
          <el-input v-model="ruleForms.mobile"></el-input>
        </el-form-item>
        <el-form-item label="邮箱" prop="email">
          <el-input v-model="ruleForms.email"></el-input>
        </el-form-item>
        <!-- <el-form-item label="权限" prop="group_id">
          <el-select v-model="ruleForm.group_id" placeholder="请选择权限组">
            <el-option
              :label="item.group_name"
              :value="item.id"
              v-for="(item, index) in group"
              :key="index"
            ></el-option>
          </el-select>
        </el-form-item> -->
        <el-form-item>
          <el-button type="primary" @click="submitFormes('ruleForms')"
            >立即创建</el-button
          >
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <!-- <el-button @click=" = false">取 消</el-button> -->
        <!-- <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button> -->
      </span>
    </el-dialog>
  </div>
</template>

<script>
export function checkPhoneNumber(rule, value, callback) {
  const reg = /^1[3|4|5|6|7|8|9]\d{9}$/;
  if (!value) {
    return callback(new Error("请填写手机号码！"));
  } else if (!reg.test(value)) {
    return callback(new Error("请填写正确的手机号码！"));
  } else {
    callback();
  }
}
Date.prototype.format = function (fmt) {
  var o = {
    "M+": this.getMonth() + 1, //月份
    "d+": this.getDate(), //日
    "h+": this.getHours(), //小时
    "m+": this.getMinutes(), //分
    "s+": this.getSeconds(), //秒
    "q+": Math.floor((this.getMonth() + 3) / 3), //季度
    S: this.getMilliseconds(), //毫秒
  };
  if (/(y+)/.test(fmt))
    fmt = fmt.replace(
      RegExp.$1,
      (this.getFullYear() + "").substr(4 - RegExp.$1.length)
    );
  for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt))
      fmt = fmt.replace(
        RegExp.$1,
        RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)
      );
  return fmt;
};
import {
  user_list,
  refuse,
  pass,
  user_details_del,
  edit_user_details,
  award_details,
  set_user_num,
  add,
  award_find,
} from "../axios/api";
export default {
  computed: {
    tableMaxHeight() {
      console.log(window.innerHeight - 350);
      return document.body.clientHeight - 350 + "px";
    },
  },

  data() {
    return {
      centerDialogVisiblese: false,
      ruleForms: {
        com_name: "",
        password: "",
        branch: "",
        mobile: "",
        email: "",
        group_id: "",
        user_name: "",
        award_id: "",
      },
      options1: [],
      rulese: {
        com_name: [
          { required: true, message: "请输入用户名", trigger: "blur" },
        ],
        user_name: [
          { required: true, message: "请输入真实姓名", trigger: "blur" },
        ],
        password: [{ required: true, message: "请输入密码", trigger: "blur" }],
        branch: [{ required: true, message: "请输入部门", trigger: "blur" }],
        mobile: [
          { required: true, validator: checkPhoneNumber, trigger: "blur" },
        ],
        email: [
          { required: true, message: "请输入邮箱地址", trigger: "blur" },
          {
            type: "email",
            message: "请输入正确的邮箱地址",
            trigger: ["blur", "change"],
          },
        ],
        group_id: [
          { required: true, message: "请选择权限组", trigger: "change" },
        ],
      },
      nums: 0,
      group_id: sessionStorage.getItem("group_id"),
      is_gai: sessionStorage.getItem("is_gai"),
      reason: "",
      xiangqingVisible: false,
      xiangqing1: {},
      weitijao: 0,
      yitongguo: "0",
      dialogVisibleS: false,
      options: [
        {
          value: "1",
          label: "通过",
        },
        {
          value: "2",
          label: "不通过",
        },
        {
          value: "4",
          label: "未提交",
        },
        {
          value: "3",
          label: "已提交",
        },
        {
          value: "0",
          label: "全部",
        },
      ],
      com_name: "",
      weishenhe: 0,
      eOBJ: {},
      is_allow: "",
      dialogXiugai: false,
      dialogVisible: false,
      chageVisible: false,
      centerDialogVisible: false,
      aaa: true,
      page: 1,
      totalPage: 0,
      weitongguo: "0",
      count: 0,
      currentPage: 1,
      id: "",
      pageSize: 0,
      src: "",
      arr: [],
      formLabelWidth: "80px",
      award: [],
      user_id: null,
      form: {
        mima: "",
        password1: "",
        password: "",
      },
      dialogFormVisible: false,
      disabled: true,
      tableData: [],
      multipleSelection: [],
      ruleForm: {
        desc: "",
      },
      rules: {
        desc: [{ required: true, message: "请填写驳回意见", trigger: "blur" }],
      },
      username: "",
    };
  },
  created() {
    this.user_list();
    this.award_find();
    this.username = sessionStorage.getItem("user_name");
  },
  components: {},

  methods: {
    submitFormes(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.ruleForms.token = sessionStorage.getItem("Token1");
          this.ruleForms.group_id = 2;
          this.ruleForms.user_id = this.user_id;

          add(this.ruleForms).then((res) => {
            console.log(res);
            if (res.data.code == 200) {
              this.$message({
                message: "添加成功",
                type: "success",
              });
              this.ruleForms = {};

              this.centerDialogVisiblese = false;
            } else {
              this.$message.error(res.data.msg);
            }
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    award_find() {
      award_find().then((res) => {
        this.options1 = res.data.data;
      });
    },
    addZiZhangHao(e) {
      console.log(e);
      this.user_id = e.id;
      this.centerDialogVisiblese = true;
    },
    addNums() {
      console.log(this.nums);
      console.log(this.eOBJ);
      let data = {
        num: this.nums,
        user_id: this.eOBJ.id,
        token: sessionStorage.getItem("Token1"),
      };
      set_user_num(data).then((res) => {
        console.log(res);
        this.nums = 0;
        this.dialogVisibleS = false;
        this.user_list();
      });
    },
    shuliang(e) {
      this.eOBJ = e;
      this.dialogVisibleS = true;
    },
    com_names() {
      console.log(this.com_name);
      this.user_list();
    },
    is_allows() {
      console.log(this.is_allow);
      this.user_list();
    },
    xiangqing(e) {
      console.log(e);

      this.xiangqing1 = e;
      this.xiangqingVisible = true;
    },
    daochu() {
      console.log(window.location.host);
      // window.location.href =
      //   "http://" +
      //   window.location.host +
      //   "/admin/user_export?token=" +
      //   sessionStorage.getItem("Token1") +
      //   "";
      window.location.href =
        "http://" +
        window.location.host +
        "/admin/user_export?token=" +
        sessionStorage.getItem("Token1") +
        "";
    },

    handleSizeChange(val) {
      console.log(val);
      this.page = val;
      this.user_list();
    },
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let arr = [];
          arr.push(this.id);
          let params = {
            id: arr,
            token: sessionStorage.getItem("Token1"),
            content: this.ruleForm.desc,
          };
          console.log(valid);
          console.log(params);
          refuse(params).then((res) => {
            console.log(res);
            if (res.data.code == 200) {
              this.$message({
                message: "已驳回",
                type: "success",
              });
            } else {
              this.$message.error(res.data.msg);
            }
          });
          this.chageVisible = false;
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    submitForm1(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let params = {
            id: this.arr,
            token: sessionStorage.getItem("Token1"),
            content: this.ruleForm.desc,
          };
          refuse(params).then((res) => {
            this.arr = [];
            console.log(res);
            if (res.data.code == 200) {
              this.$message({
                message: "已驳回",
                type: "success",
              });
            } else {
              this.$message.error(res.data.msg);
            }
          });
          this.chageVisible = false;
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
      this.chageVisible = false;
    },
    // handleSizeChange(val) {
    //   console.log(`每页 ${val} 条`);
    // },
    // handleCurrentChange(val) {
    //   console.log(`当前页: ${val}`);
    //   this.page = val;
    //   this.user_list();
    // },
    user_list() {
      let params = {
        token: sessionStorage.getItem("Token1"),
        page: this.page,
        com_name: this.com_name,
        is_allow: this.is_allow,
      };
      user_list(params).then((res) => {
        console.log(res);
        this.currentPage = res.data.data.page + 0;
        this.totalPage = res.data.data.totalPage + 0;
        console.log(res.data.data.weitongguo);
        console.log(res.data.data.yitongguo);
        if (res.data.data.weitongguo) {
          this.weitongguo = res.data.data.weitongguo;
        }
        if (res.data.data.yitongguo) {
          this.yitongguo = res.data.data.yitongguo;
        }
        if (res.data.data.count) {
          this.count = res.data.data.count;
        }
        if (res.data.data.weishenhe) {
          this.weishenhe = res.data.data.weishenhe;
        }
        if (res.data.data.weitijao) {
          this.weitijao = res.data.data.weitijao;
        }
        this.pageSize = parseInt(res.data.data.pageSize);
        console.log(this.pageSize);
        this.tableData = res.data.data.data;
        this.tableData.forEach((item) => {
          var myDate = new Date(item.create_time * 1000);
          myDate.setDate(myDate.getDate());
          console.log(myDate.setDate(myDate.getDate()));
          item.create_time = myDate.format("yyyy年MM月dd日");
        });
      });
    },
    Verification() {
      if (this.form.password.length >= 6) {
        if (this.form.password1 != this.form.password) {
          this.$message({
            message: "两次密码不一致请重新输入",
            type: "error",
          });
          this.form.password1 = "";
        }
      } else {
        this.form.password = "";
        this.form.password1 = "";
        this.$message({
          message: "密码最低为6位数",
          type: "error",
        });
      }
    },

    shenhe() {
      let params = {
        token: sessionStorage.getItem("Token1"),
        id: this.arr,
      };
      pass(params).then((res) => {
        console.log(res);
        this.arr = [];
        if (res.data.code == 200) {
          this.$message({
            message: "已批量通过",
            type: "success",
          });
        } else {
          this.$message({
            message: res.data.msg,
          });
        }
      });
    },
    quedingtongguo() {
      let arr = [];
      arr.push(this.id);
      let params = {
        token: sessionStorage.getItem("Token1"),
        id: arr,
      };
      console.log(params);
      pass(params).then((res) => {
        console.log(res);
        if (res.data.code == 200) {
          this.$message({
            message: "已通过",
            type: "success",
          });
        }
      });
      this.centerDialogVisible = false;
    },
    handledetails(e) {
      this.centerDialogVisible = true;
      this.id = e.id;
    },
    handleput1() {
      this.ruleForm.desc = "";
      this.chageVisible = true;
    },
    handleput(e) {
      this.id = e.id;
      this.ruleForm.desc = "";
      this.chageVisible = true;
    },
    tupian(e) {
      console.log(e);
      this.src = e.file_url;
      this.dialogVisible = true;
    },
    handleput2(e) {
      this.award = e.award;
      this.id = e.id;
      this.dialogXiugai = true;
    },
    queding() {
      if (this.reason == "") {
        alert("填写修改原因");
      } else {
        this.dialogXiugai = false;
        console.log(this.award);
        let params = {
          token: sessionStorage.getItem("Token1"),
          data: this.award,
          reason: this.reason,
          user_id: this.id,
        };
        edit_user_details(params).then((res) => {
          console.log(res);
          if (res.data.code == 200) {
            this.$message({
              message: "修改成功",
              type: "success",
            });
            this.reason = "";
          } else {
            this.$message.error(res.data.msg);
          }
          this.user_list();
        });
      }
    },
    del() {
      console.log(this.arr);
      let params = {
        token: sessionStorage.getItem("Token1"),
        id: this.arr,
      };
      user_details_del(params).then((res) => {
        console.log(res);
        if (res.data.code == 200) {
          this.$message({
            message: "删除成功",
            type: "success",
          });
        } else {
          this.$message.error("删除失败");
        }
        this.user_list();
      });
    },
    handleDel(e) {
      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let arr = [];
          arr.push(e.id);
          let params = {
            token: sessionStorage.getItem("Token1"),
            id: arr,
          };
          user_details_del(params).then((res) => {
            if (res.data.code == 200) {
              this.$message({
                message: "删除成功",
                type: "success",
              });
            } else {
              this.$message.error("删除失败");
            }
            this.user_list();
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionChange(val) {
      console.log(val);
      val.forEach((item) => {
        this.arr.push(item.id);
      });
      this.arr = [...new Set(this.arr)];
      console.log(this.arr);

      if (val.length > 0) {
        this.disabled = false;
      } else {
        this.arr = [];
        this.disabled = true;
      }
      this.multipleSelection = val;
    },
  },
};
</script>

<style scoped>
.apply {
  width: 100%;
  height: 100%;
  background-color: #fff;
  /* overflow-x: scroll; */
  /* overflow-y: scroll; */
  /* overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between; */
}
.gongneng {
  display: flex;
  align-items: center;
}
.gongneng > div {
  margin: 0 10px;
}
.table {
  width: 95%;
  height: 77%;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
  overflow: auto;
  overflow-y: scroll;
}
.table::-webkit-scrollbar {
  display: none;
}
.apply::-webkit-scrollbar {
  display: none;
}
.caozuo {
  box-sizing: border-box;
  padding: 20px;
  display: flex;
  justify-content: space-between;
}
.fenye {
  width: 100%;
  height: 40px;

  display: flex;
  justify-content: center;
  align-items: center;
}
.btn {
  font-size: 12px;
}
.tongguo {
  display: flex;
  justify-content: center;
  align-items: center;
}
.image {
  width: 100%;
}
.image > img {
  display: block;
  margin: 0 auto;
  width: 100%;
  height: auto;
}
/* .table::-webkit-scrollbar {
  display: none;
} */
.item {
  /* display: flex; */
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 10px;
}
.items {
  width: 100%;
  font-size: 20px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding: 10px;
}
.assa {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
</style>
